var express = require('express');
var manage = require('./manage');
var api = require('./api');

var router = express.Router();

/**
 * static pages
 * */
router.get('/', function (req, res) {
  res.render('index', {title: '英语词汇查询'});
});
router.get('/document', function (req, res) {
  res.render('document', {});
});

/**
 * open api
 * */
router.get('/search', api.search);
router.post('/search', api.searchPost);
router.all('/filterScale', api.filter);
router.all('/phonetic', api.phonetic);

/**
 * management api
 * */
router.post('/add', manage.add);
router.post('/save', manage.save);
router.get('/export', manage.export);

module.exports = router;
